<!doctype html>
<html>
    <head>
        <meta charset="UTF-8" />
        <script src="http://cdn.bootcss.com/jquery/1.8.3/jquery.js"></script>
    </head>
    <body>
        <div style="height: 1780px;border:solid 1px black;">
            <div id="boxid" style="height: 100px;width: 100px;border:solid 1px black;position: absolute; background-color: blue;">
                
            </div>
            <input type="button" value="一樓" style="position: absolute;top:300px;left:200px;" id="btn1" />
            <input type="button" value="二樓" style="position: absolute;top:1000px;left:500px;" id="btn2" />
        </div>
<script>
$(function(){
    $("#btn1,#btn2").click(function(e){
        var box = $("#boxid");
        var box_height = box.height();
        var box_width = box.width();
        var _x = e.pageX;
        var _y = e.pageY;
        var top = _y - box_height - 50;
        var left = _x;
        var boxObj = new Object();
        boxObj.top = top;
        boxObj.left = left;
        box.css(boxObj);
        box.fadeTo(50, 0.25);
        var obj = new Object();
        obj.x = _x;
        obj.y = _y;
        obj.height = box_height;
        obj.width = box_width;
        console.log(obj);
    });
});
</script>
    </body>
</html>